# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=php7-gearman
_extname=gearman
pkgver=2.1.0
pkgrel=0
pkgdesc="PHP 7 wrapper to libgearman - PECL"
url="https://pecl.php.net/package/gearman/"
arch="all"
license="PHP-3.01"
depends="php7-pcntl"
makedepends="gearman-dev php7-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"
provides="php7-pecl-gearman=$pkgver-r$pkgrel" # for forward compatibility

build() {
	phpize7
	./configure \
		--prefix=/usr \
		--with-php-config=/usr/bin/php-config7
	make
}

check() {
	php7 -dextension=modules/$_extname.so --ri $_extname
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		TESTS=--show-diff SKIP_ONLINE_TESTS=1
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php7/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="78a3877ba2212777a1c8387ce14c0e2210f3141b9a6bb87507547f6e3f02dfc03387111e6ac84729dba8b1b9c0483ef1ba3c458480bc0f2e9d68dd49bd073ba6  php-pecl-gearman-2.1.0.tgz"
